#!/bin/bash

echo "=== 启动RocketMQ Docker环境 ==="

# 创建日志目录
mkdir -p logs/rmqnamesrv logs/rmqbroker

# 启动RocketMQ服务
echo "启动RocketMQ NameServer..."
docker-compose up -d rmqnamesrv

# 等待NameServer启动
echo "等待NameServer启动..."
sleep 10

echo "启动RocketMQ Broker..."
docker-compose up -d rmqbroker

# 等待Broker启动
echo "等待Broker启动..."
sleep 15

echo "启动RocketMQ Console..."
docker-compose up -d rmqconsole

# 检查服务状态
echo "检查服务状态..."
docker-compose ps

echo ""
echo "=== RocketMQ服务启动完成 ==="
echo "NameServer: localhost:9876"
echo "Broker: localhost:10911"
echo "Console: http://localhost:8081"
echo ""
echo "现在可以启动Spring Boot应用了！"
echo "使用命令: mvn spring-boot:run"
